﻿<UserControl x:Class="Blackbird.Studio.View.EditableMultispriteView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:view="clr-namespace:Blackbird.Studio.View"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             d:DataContext="{Binding Source={StaticResource ResourceKey=StaticViewModel}, Path=Instance.EditableMultispriteViewModel}">
    <UserControl.Resources>
        <Style x:Key="FramesetSelectorButtonStyle" TargetType="Button">
            <Setter Property="Width" Value="125px" />
            <Setter Property="Height" Value="75px" />
            <Setter Property="Margin" Value="10" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>      
        <ListView ItemsSource="{Binding ViewModels}">
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Button Content="{Binding DisplayName}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListView}}, Path=DataContext.SelectChildCommand.Command}" CommandParameter="{Binding}" Style="{StaticResource FramesetSelectorButtonStyle}" />
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <Border Grid.Row="1">
            <view:EditableFramesetListView DataContext="{Binding SelectedItem}" />
        </Border>
    </Grid>
</UserControl>